<?php
//======================================================================================
// DATAHUB - Logout
//
// Programmer: JJ
// Date : 2024-11-03
//
// Copyright Reeft A/S (c) - 2024
//======================================================================================
//======================================================================================
// General config
//======================================================================================
include "config/config.php";
include "include/REEFT_date_convert.php";
//======================================================================================
// Get session variables
//======================================================================================
include "include/getsession.php";
//======================================================================================
// Encode me..
//======================================================================================
$timestamp = urlencode( $timestamp );
//======================================================================================
// Setup parms
//======================================================================================
$parms = '?'
. 'username=' . $session_username
. '&uuid=' . $session_uuid
;
//======================================================================================
// Set URL
//======================================================================================
$url = $DFT_WEBSERVICE_URL_DATAHUB . '/' . 'HUB_LOGOUT';
// Add parms
$url = $url . $parms;
//======================================================================================
// Validate login
//======================================================================================
// Create a new cURL resource
$ch = curl_init($url);
// Attach encoded JSON string to the POST fields
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
// Set the content type to application/json
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers );
// Return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, false);
//curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' );
curl_setopt($ch, CURLOPT_HEADER, false); // we do not need headers
curl_setopt($ch, CURLOPT_NOBODY, false); // we don't need body
// Execute the GET request
$result = curl_exec($ch);
$ary = curl_getinfo($ch);
// Close cURL resource
curl_close($ch);
//======================================================================================
// It's the end of the world...
//======================================================================================
session_start();
session_destroy();
header("Location: login.php");
exit;
?>